package WaiBao;

import java.util.Arrays;

public class LiuYiLan {
    public static void main(String[] args) {
        String[] name = {"张国庆(班长)","李琦(副班长)", "小李(学习委员)","刘领淑(文艺委员)", "李到期", "王军志", "王劲松", "李浩天", "闫志广", "黄启红", "李凯", "李昊天",
                "王婷玉", "刘晓晓", "王海洋", "黄广招", "杨荣耀", "李宁", "花木兰", "李白", "孙宝树", "周仁义", "李富贵", "张规财", "巴旦木", "芭蕉", "桂皮", "香叶",
                "王辰", "刘怡兰(学生)"};//考生本人: 刘怡兰(学生)
        int[] age = {18, 19, 21, 18, 19, 21, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 19, 18, 19, 19, 19, 20, 20, 20, 18, 20, 18, 18, 20};//最后一位：考生年龄:20

        double[] newyork1 = {64, 72, 76, 84, 77, 77, 78, 89, 81, 94, 91, 87, 85, 79, 61, 68, 99, 99, 90, 80, 82, 91, 95, 65, 75, 74, 94, 74, 88, 94};
        double[] newyork2 = {84, 81, 78, 74, 68, 97, 98, 69, 70, 90, 94, 70, 66, 85, 95, 65, 71, 89, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 95};
        double[] newyork3 = {92, 69, 84, 95, 78, 69, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 66, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};



        double sougou1 ;//代表每个学生的总分
        double sougou2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            sougou1 = newyork1[i] +newyork2[i] + newyork3[i];
//            sougou2 = (sougou1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + sougou1);
//            System.out.println(name[i] + "的平均分为:" + sougou2);
//        }


        double quyu1 = 0,quyu2= 0;
        double[] beijing  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            quyu1 = newyork1[i] + newyork2[i] + newyork3[i];
//            quyu2 = (quyu1 * 1.0) / 3;
//            beijing  [i] =quyu1;
//        }
//
//        for (int i = 0; i <  beijing.length - 1; i++) {
//            for (int j = 0; j < beijing.length - i - 1; j++) {
//                if (beijing [j] < beijing[j + 1]) {
//                    double tep = beijing[j];
//                    beijing[j] = beijing[j + 1];
//                    beijing[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( beijing[i]);
//        }



        double dui1 = 0, dui2 = 0,dui3 = 0;//计算每门课的平均分
        double you1 = 0, you2 = 0, you3 = 0;//计算每门课标准差
        double que1 = 0, que2 = 0,que3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < newyork1.length; i++) {
            he += newyork1[i];
        }
        dui1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" +dui1);
        double Sum = 0;
        for (int i = 0; i <newyork2.length; i++) {
            Sum +=newyork2[i];
        }
        dui2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + dui2);
        double sum = 0;
        for (int i = 0; i <newyork3.length; i++) {
            sum +=newyork3[i];
        }
        dui3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + dui3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <newyork1.length; i++) {
            c1 += (newyork1[i] - dui1) * (newyork1[i] - dui1);
        }
        you1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + you1);
        for (int i = 0; i <newyork2.length; i++) {
            c2 += (newyork2[i] - dui2) * (newyork2[i] -dui2);
        }
        you2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" + you2);

        for (int i = 0; i <newyork3.length; i++) {
            c3 += (newyork3[i] - dui3) * (newyork3[i] - dui3);
        }
        you3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + you3);
//
////
//        Arrays.sort(newyork1);
//        Arrays.sort(newyork2);
//        Arrays.sort(newyork3);
//        que1 = (newyork1[14] + newyork2[15]) * 1.0 / 2;
//        que2 = (newyork2[14] +newyork2[15]) * 1.0 / 2;
//        que3 = (newyork3[14] + newyork3[15]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" + que1);
//        System.out.println("农业设施设计与制造的中位数为:" + que2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  que3);




    }
}
